package net.xinqushi.pthread.pthreadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 *  如何关闭进入死循环的线程?
 */
public class ThreadPoolTest {

    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(5);
        service.execute(()->{
            while (true)
                System.out.println(Thread.currentThread().getName());
        });
        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        service.shutdown();
    }
}
